﻿using System;
using System.Collections.Generic;
using System.Text;

using DirectShowLib;
using DirectShowLib.BDA;
using DirectShowLib.DES;

using System.Runtime.InteropServices.ComTypes;

namespace SetTopBox.BDA
{
    public class Device
    {
        private DVBSystemType network;
        public DVBSystemType Network
        {
            get
            {
                return network;
            }
        }

        private IMoniker source;
        public IMoniker Source
        {
            get
            {
                return source;
            }
        }
        private IMoniker receiver;
        public IMoniker Receiver
        {
            get
            {
                return receiver;
            }
        }
        private string friendlyName;
        public string FriendlyName
        {
            get
            {
                return friendlyName;
            }
        }

        public Device(DVBSystemType network, IMoniker source, IMoniker receiver)
        {
            this.network = network;
            this.source = source;
            this.receiver = receiver;

            object pBag;
            Guid propBagGuid = typeof(IPropertyBag).GUID;
            Receiver.BindToStorage(null, null, ref propBagGuid, out pBag);
            object fName;
            ((IPropertyBag)pBag).Read("FriendlyName", out fName, null);
            friendlyName = (string)fName;
        }
    }
}
